package com.woniuxy.service.impl;

import com.github.pagehelper.PageHelper;
import com.woniuxy.dao.GoodsDao;
import com.woniuxy.dao.UserDao;
import com.woniuxy.pojo.Category;
import com.woniuxy.pojo.Goods;
import com.woniuxy.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author 罗蔚
 * @Date 2022/3/27 17:29
 * @Description TODO
 */
@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    private GoodsDao goodsDao;

    @Override
    public List<Goods> findNewGoods() {
        return goodsDao.findNewGoods();
    }

    @Override
    public List<Goods> findHotGoods() {
        return goodsDao.findHotGoods();
    }

    @Override
    public List<Goods> findPageByCid1(int cid, int currentPage) {
        // 页数, 每页条数
        PageHelper.startPage(currentPage, 12);

        return goodsDao.findPageByCid1(cid);
    }

    @Override
    public List<Goods> findGoodsSalesByCid(int cid) {
        return goodsDao.findGoodsSalesByCid(cid);
    }

    @Override
    public Goods details(int gid) {
        return goodsDao.findByid(gid);
    }

    @Override
    public Category findCidAndCnameByGid(int gid) {
        return goodsDao.findCidAndCnameByGid(gid);
    }

    @Override
    public List<Goods> findLikeByCid(int cid) {
        return goodsDao.findLikeByCid(cid);
    }

    @Override
    public List<Goods> findLike(String name) {
        return goodsDao.findLike(name);
    }
}
